﻿@using nanoCMS.Blog.Resources
@using nanoCMS.Blog.WebUI.Models.ViewModels
@using nanoCMS.Core
@using nanoCMS.Core.WebProviders.HtmlHelpers
@model List<BlogPostVM>

    @Html.ActionLink("Add blog post", "Create", "BlogPost", new { area = "Blog" }, new { @class = "modal" })


<article class="article">
    @if (Model.Any()) {
        foreach (var item in Model) {
            <article class="post">
                <h3>@Html.LinkInner(@item.Title, new { id = item.BlogPostID, elementKey = ViewBag.ElementKey, action = "ShowBlogPost" }, new object())</h3>
                <span class="meta">@Translation.PublishedBy <a href="#">Tommy</a>, @item.CreatedDate</span>
                    <div class="news-image">
                        <img src="images/blog/img1.jpg" width="200" height="150" alt="" />
                    </div>
                    <div class="news-text">
                        @Html.Raw( item.Summary)
                    </div>
                    
                    @if (SessionManagerBase.IsAdmin) {
                        @Html.ActionLink(Translation.Edit, "Edit", "Blogpost", new { area = "Blog", id = item.BlogPostID }, new { @class = "modal" })
                    }
                    @Html.Link("Edit blog post", "EditBlogPost", new { id=item.BlogPostID, returnUrl = Request.Url })

                @Html.LinkInner(Translation.SeeMore, new { id = item.BlogPostID, elementKey = ViewBag.ElementKey, action = "ShowBlogPost" }, new { @class="button" })
                
            </article>   
            <div class="separator"> </div>
        }
    }
</article>


